home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-2.iso / Files II / Prog / U-Z / VideoToolbox 4.95.sit / VideoToolbox / VideoToolboxSources / TranslateLinefeeds.c < prev    next >
MacBinary  |  1994-10-08  |  7.9 KB  |  [TEXT/MMCC]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Sat Oct 8 20:22:13 1994, modified Sat Oct 8 20:22:13 1994, creator 'MMCC', type ASCII, 7181 bytes "TranslateLinefeeds.c" , at 0x1c8d 616 bytes resource default (weak)
99% file data default
49% TrID Macintosh plain text (MacBinary) default
33% TrID raw Group 3 FAX bitmap default (weak)
16% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MMCC]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 14 54 72 61 6e 73 6c | 61 74 65 4c 69 6e 65 66 |..Transl|ateLinef|
|00000010| 65 65 64 73 2e 63 00 00 | 00 00 00 00 00 00 00 00 |eeds.c..|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 4d 43 | 43 00 00 00 00 00 00 00 |.TEXTMMC|C.......|
|00000050| 00 00 00 00 00 1c 0d 00 | 00 02 68 aa bc e8 35 aa |........|..h...5.|
|00000060| bc e8 35 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..5.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 bc 6a 00 00 |........|.....j..|
|00000080| 2f 2a 0d 54 72 61 6e 73 | 6c 61 74 65 4c 69 6e 65 |/*.Trans|lateLine|
|00000090| 66 65 65 64 73 2e 63 20 | 68 65 6c 70 73 20 74 6f |feeds.c |helps to|
|000000a0| 20 72 65 73 6f 6c 76 65 | 20 61 6e 20 69 6e 63 6f | resolve| an inco|
|000000b0| 6d 70 61 74 69 62 69 6c | 69 74 79 20 62 65 74 77 |mpatibil|ity betw|
|000000c0| 65 65 6e 20 74 68 65 20 | 4d 50 57 20 73 74 64 69 |een the |MPW stdi|
|000000d0| 6f 0d 6c 69 62 72 61 72 | 79 20 61 6e 64 20 63 6f |o.librar|y and co|
|000000e0| 64 65 20 72 65 73 6f 75 | 72 63 65 73 20 67 65 6e |de resou|rces gen|
|000000f0| 65 72 61 74 65 64 20 62 | 79 20 74 68 65 20 54 48 |erated b|y the TH|
|00000100| 49 4e 4b 20 43 20 63 6f | 6d 70 69 6c 65 72 2e 20 |INK C co|mpiler. |
|00000110| 54 68 69 73 20 69 73 20 | 61 20 70 72 6f 62 6c 65 |This is |a proble|
|00000120| 6d 0d 69 66 20 79 6f 75 | 20 6e 65 65 64 20 74 6f |m.if you| need to|
|00000130| 20 6c 69 6e 6b 20 74 68 | 65 6d 20 74 6f 67 65 74 | link th|em toget|
|00000140| 68 65 72 2e 20 54 68 65 | 20 70 72 6f 62 6c 65 6d |her. The| problem|
|00000150| 20 69 73 20 74 68 61 74 | 20 4d 50 57 20 61 6e 64 | is that| MPW and|
|00000160| 20 54 48 49 4e 4b 20 43 | 20 68 61 76 65 0d 61 64 | THINK C| have.ad|
|00000170| 6f 70 74 65 64 20 64 69 | 66 66 65 72 65 6e 74 20 |opted di|fferent |
|00000180| 73 6f 6c 75 74 69 6f 6e | 73 20 74 6f 20 74 68 65 |solution|s to the|
|00000190| 20 70 72 6f 62 6c 65 6d | 20 74 68 61 74 20 53 74 | problem| that St|
|000001a0| 61 6e 64 61 72 64 20 43 | 20 73 70 65 63 69 66 69 |andard C| specifi|
|000001b0| 65 73 20 74 68 61 74 0d | 6c 69 6e 65 66 65 65 64 |es that.|linefeed|
|000001c0| 73 20 73 68 6f 75 6c 64 | 20 62 65 20 72 65 70 72 |s should| be repr|
|000001d0| 65 73 65 6e 74 65 64 20 | 61 73 20 27 5c 6e 27 20 |esented |as '\n' |
|000001e0| 28 6e 6f 72 6d 61 6c 6c | 79 20 31 30 29 20 69 6e |(normall|y 10) in|
|000001f0| 73 69 64 65 20 70 72 6f | 67 72 61 6d 73 2c 20 79 |side pro|grams, y|
|00000200| 65 74 0d 41 70 70 6c 65 | 2c 20 69 6e 20 74 68 65 |et.Apple|, in the|
|00000210| 69 72 20 77 69 73 64 6f | 6d 2c 20 64 65 63 69 64 |ir wisdo|m, decid|
|00000220| 65 64 20 74 68 61 74 20 | 6c 69 6e 65 66 65 65 64 |ed that |linefeed|
|00000230| 73 20 73 68 6f 75 6c 64 | 20 62 65 20 72 65 70 72 |s should| be repr|
|00000240| 65 73 65 6e 74 65 64 20 | 62 79 20 31 33 0d 28 6e |esented |by 13.(n|
|00000250| 6f 72 6d 61 6c 6c 79 20 | 27 5c 72 27 29 20 69 6e |ormally |'\r') in|
|00000260| 20 4d 61 63 69 6e 74 6f | 73 68 20 41 53 43 49 49 | Macinto|sh ASCII|
|00000270| 20 74 65 78 74 20 66 69 | 6c 65 73 2e 20 54 68 65 | text fi|les. The|
|00000280| 20 70 72 6f 62 6c 65 6d | 20 69 73 20 68 61 6e 64 | problem| is hand|
|00000290| 6c 65 64 20 69 6e 76 69 | 73 69 62 6c 79 0d 62 79 |led invi|sibly.by|
|000002a0| 20 62 6f 74 68 20 63 6f | 6d 70 69 6c 65 72 73 2e | both co|mpilers.|
|000002b0| 20 4d 50 57 20 72 65 64 | 65 66 69 6e 65 73 20 27 | MPW red|efines '|
|000002c0| 5c 6e 27 20 74 6f 20 6d | 65 61 6e 20 31 33 2e 20 |\n' to m|ean 13. |
|000002d0| 54 48 49 4e 4b 20 43 20 | 74 72 61 6e 73 6c 61 74 |THINK C |translat|
|000002e0| 65 73 20 31 33 20 74 6f | 20 31 30 0d 28 61 6e 64 |es 13 to| 10.(and|
|000002f0| 20 76 69 63 65 20 76 65 | 72 73 61 29 20 77 68 65 | vice ve|rsa) whe|
|00000300| 6e 20 77 72 69 74 69 6e | 67 20 61 6e 64 20 72 65 |n writin|g and re|
|00000310| 61 64 69 6e 67 20 74 65 | 78 74 20 73 74 72 65 61 |ading te|xt strea|
|00000320| 6d 73 2e 20 55 6e 66 6f | 72 74 75 6e 61 74 65 6c |ms. Unfo|rtunatel|
|00000330| 79 2c 20 77 68 65 6e 20 | 79 6f 75 0d 63 6f 6d 70 |y, when |you.comp|
|00000340| 69 6c 65 20 54 48 49 4e | 4b 20 43 20 63 6f 64 65 |ile THIN|K C code|
|00000350| 20 72 65 73 6f 75 72 63 | 65 73 20 74 68 61 74 20 | resourc|es that |
|00000360| 63 61 6c 6c 20 74 68 65 | 20 4d 50 57 20 73 74 64 |call the| MPW std|
|00000370| 69 6f 20 6c 69 62 72 61 | 72 79 20 62 6f 74 68 20 |io libra|ry both |
|00000380| 73 6f 6c 75 74 69 6f 6e | 73 0d 61 72 65 20 65 6c |solution|s.are el|
|00000390| 69 6d 69 6e 61 74 65 64 | 20 61 6e 64 20 74 68 65 |iminated| and the|
|000003a0| 20 6f 6c 64 20 70 72 6f | 62 6c 65 6d 20 72 61 69 | old pro|blem rai|
|000003b0| 73 65 73 20 69 74 73 20 | 75 67 6c 79 20 68 65 61 |ses its |ugly hea|
|000003c0| 64 2e 0d 0d 54 68 69 73 | 20 66 69 6c 65 20 64 6f |d...This| file do|
|000003d0| 65 73 20 4e 4f 54 20 53 | 55 50 50 4f 52 54 20 4d |es NOT S|UPPORT M|
|000003e0| 65 74 72 6f 77 65 72 6b | 73 20 43 6f 64 65 57 61 |etrowerk|s CodeWa|
|000003f0| 72 72 69 6f 72 20 43 20 | 63 6f 6d 70 69 6c 65 72 |rrior C |compiler|
|00000400| 2e 0d 0d 54 72 61 6e 73 | 6c 61 74 65 4c 69 6e 65 |...Trans|lateLine|
|00000410| 66 65 65 64 73 2e 63 20 | 69 6e 74 65 72 63 65 70 |feeds.c |intercep|
|00000420| 74 73 20 74 68 65 20 63 | 61 6c 6c 73 20 74 6f 20 |ts the c|alls to |
|00000430| 74 68 65 20 28 4d 50 57 | 29 20 73 74 64 69 6f 20 |the (MPW|) stdio |
|00000440| 6c 69 62 72 61 72 79 20 | 61 6e 64 20 70 61 72 74 |library |and part|
|00000450| 69 61 6c 6c 79 0d 69 6d | 70 6c 65 6d 65 6e 74 73 |ially.im|plements|
|00000460| 20 74 68 65 20 54 48 49 | 4e 4b 20 43 20 73 74 64 | the THI|NK C std|
|00000470| 69 6f 20 6c 69 62 72 61 | 72 79 20 63 6f 6e 76 65 |io libra|ry conve|
|00000480| 6e 74 69 6f 6e 20 6f 66 | 20 74 72 61 6e 73 6c 61 |ntion of| transla|
|00000490| 74 69 6e 67 20 5c 6e 20 | 74 6f 20 5c 72 20 61 6e |ting \n |to \r an|
|000004a0| 64 20 76 69 63 65 0d 76 | 65 72 73 61 20 6f 6e 20 |d vice.v|ersa on |
|000004b0| 69 6e 70 75 74 20 61 6e | 64 20 6f 75 74 70 75 74 |input an|d output|
|000004c0| 20 74 6f 20 74 65 78 74 | 20 66 69 6c 65 73 2e 20 | to text| files. |
|000004d0| 4c 65 74 27 73 20 63 61 | 6c 6c 20 74 68 69 73 20 |Let's ca|ll this |
|000004e0| 22 6c 69 6e 65 66 65 65 | 64 20 74 72 61 6e 73 6c |"linefee|d transl|
|000004f0| 61 74 69 6f 6e 22 2e 0d | 28 41 73 20 69 6e 20 74 |ation"..|(As in t|
|00000500| 68 65 20 54 48 49 4e 4b | 20 43 20 73 74 64 69 6f |he THINK| C stdio|
|00000510| 20 6c 69 62 72 61 72 79 | 2c 20 6e 6f 20 74 72 61 | library|, no tra|
|00000520| 6e 73 6c 61 74 69 6f 6e | 20 69 73 20 70 65 72 66 |nslation| is perf|
|00000530| 6f 72 6d 65 64 20 66 6f | 72 20 62 69 6e 61 72 79 |ormed fo|r binary|
|00000540| 20 66 69 6c 65 73 2e 29 | 0d 54 68 65 73 65 20 72 | files.)|.These r|
|00000550| 6f 75 74 69 6e 65 73 20 | 73 68 6f 75 6c 64 20 6f |outines |should o|
|00000560| 6e 6c 79 20 62 65 20 75 | 73 65 64 20 62 79 20 54 |nly be u|sed by T|
|00000570| 48 49 4e 4b 20 43 20 63 | 6f 64 65 20 72 65 73 6f |HINK C c|ode reso|
|00000580| 75 72 63 65 73 20 74 68 | 61 74 20 6d 75 73 74 20 |urces th|at must |
|00000590| 75 73 65 20 74 68 65 0d | 4d 50 57 20 73 74 64 69 |use the.|MPW stdi|
|000005a0| 6f 20 6c 69 62 72 61 72 | 79 20 28 62 65 63 61 75 |o librar|y (becau|
|000005b0| 73 65 20 74 68 65 20 4d | 50 57 20 43 20 73 74 64 |se the M|PW C std|
|000005c0| 69 6f 20 6c 69 62 72 61 | 72 79 20 64 6f 65 73 6e |io libra|ry doesn|
|000005d0| 27 74 20 64 6f 20 6c 69 | 6e 65 66 65 65 64 0d 74 |'t do li|nefeed.t|
|000005e0| 72 61 6e 73 6c 61 74 69 | 6f 6e 29 2e 20 44 6f 6e |ranslati|on). Don|
|000005f0| 27 74 20 63 68 61 6e 67 | 65 20 79 6f 75 72 20 43 |'t chang|e your C|
|00000600| 20 70 72 6f 67 72 61 6d | 73 3b 20 75 73 65 20 74 | program|s; use t|
|00000610| 68 65 20 73 74 61 6e 64 | 61 72 64 20 6e 61 6d 65 |he stand|ard name|
|00000620| 73 20 66 6f 72 20 74 68 | 65 20 73 74 64 69 6f 0d |s for th|e stdio.|
|00000630| 6c 69 62 72 61 72 79 20 | 72 6f 75 74 69 6e 65 73 |library |routines|
|00000640| 20 61 6e 64 20 6a 75 73 | 74 20 23 69 6e 63 6c 75 | and jus|t #inclu|
|00000650| 64 65 20 74 68 65 20 54 | 72 61 6e 73 6c 61 74 65 |de the T|ranslate|
|00000660| 4c 69 6e 65 66 65 65 64 | 73 2e 68 20 68 65 61 64 |Linefeed|s.h head|
|00000670| 65 72 20 28 61 66 74 65 | 72 20 73 74 64 69 6f 2e |er (afte|r stdio.|
|00000680| 68 29 2e 0d 54 68 65 20 | 54 72 61 6e 73 6c 61 74 |h)..The |Translat|
|00000690| 65 4c 69 6e 65 66 65 65 | 64 73 2e 68 20 68 65 61 |eLinefee|ds.h hea|
|000006a0| 64 65 72 20 75 73 65 73 | 20 70 72 65 70 72 6f 63 |der uses| preproc|
|000006b0| 65 73 73 6f 72 20 6d 61 | 63 72 6f 73 20 74 6f 20 |essor ma|cros to |
|000006c0| 72 65 64 69 72 65 63 74 | 20 6e 65 61 72 6c 79 20 |redirect| nearly |
|000006d0| 61 6c 6c 20 74 68 65 0d | 73 74 64 69 6f 20 63 61 |all the.|stdio ca|
|000006e0| 6c 6c 73 20 74 6f 20 74 | 68 69 73 20 66 69 6c 65 |lls to t|his file|
|000006f0| 2c 20 77 68 69 63 68 20 | 69 6e 74 65 72 70 6f 73 |, which |interpos|
|00000700| 65 73 20 6c 69 6e 65 66 | 65 65 64 20 74 72 61 6e |es linef|eed tran|
|00000710| 73 6c 61 74 69 6f 6e 20 | 61 6e 64 20 63 61 6c 6c |slation |and call|
|00000720| 73 20 74 68 65 0d 28 4d | 50 57 29 20 73 74 64 69 |s the.(M|PW) stdi|
|00000730| 6f 20 6c 69 62 72 61 72 | 79 2e 0d 0d 49 27 76 65 |o librar|y...I've|
|00000740| 20 69 6d 70 6c 65 6d 65 | 6e 74 65 64 20 61 6c 6c | impleme|nted all|
|00000750| 20 74 68 65 20 69 2f 6f | 20 72 6f 75 74 69 6e 65 | the i/o| routine|
|00000760| 73 20 69 6e 20 73 74 64 | 69 6f 2e 68 20 65 78 63 |s in std|io.h exc|
|00000770| 65 70 74 20 66 73 63 61 | 6e 66 20 61 6e 64 20 73 |ept fsca|nf and s|
|00000780| 63 61 6e 66 2e 0d 54 68 | 65 79 27 72 65 20 64 69 |canf..Th|ey're di|
|00000790| 66 66 69 63 75 6c 74 20 | 74 6f 20 68 61 6e 64 6c |fficult |to handl|
|000007a0| 65 2c 20 61 6e 64 20 49 | 20 73 75 73 70 65 63 74 |e, and I| suspect|
|000007b0| 20 74 68 61 74 20 6d 6f | 73 74 20 75 73 65 73 20 | that mo|st uses |
|000007c0| 6f 66 20 74 68 6f 73 65 | 20 72 6f 75 74 69 6e 65 |of those| routine|
|000007d0| 73 0d 77 6f 75 6c 64 6e | 27 74 20 64 69 73 74 69 |s.wouldn|'t disti|
|000007e0| 6e 67 75 69 73 68 20 2f | 6e 20 66 72 6f 6d 20 2f |nguish /|n from /|
|000007f0| 72 20 61 6e 79 77 61 79 | 2e 0d 0d 41 6c 6c 20 74 |r anyway|...All t|
|00000800| 68 65 20 70 72 69 6e 74 | 66 2d 72 65 6c 61 74 65 |he print|f-relate|
|00000810| 64 20 72 6f 75 74 69 6e | 65 73 20 61 72 65 20 66 |d routin|es are f|
|00000820| 75 6e 6e 65 6c 65 64 20 | 74 68 72 6f 75 67 68 20 |unneled |through |
|00000830| 76 66 70 72 69 6e 74 66 | 54 4c 2e 20 54 68 65 20 |vfprintf|TL. The |
|00000840| 61 63 74 75 61 6c 0d 69 | 2f 6f 20 69 73 20 64 6f |actual.i|/o is do|
|00000850| 6e 65 20 62 79 20 76 66 | 70 72 69 6e 74 66 28 29 |ne by vf|printf()|
|00000860| 2e 20 49 66 20 69 74 27 | 73 20 61 20 22 74 65 78 |. If it'|s a "tex|
|00000870| 74 22 20 73 74 72 65 61 | 6d 20 28 61 73 20 6f 70 |t" strea|m (as op|
|00000880| 70 6f 73 65 64 20 74 6f | 20 61 20 22 62 69 6e 61 |posed to| a "bina|
|00000890| 72 79 22 0d 73 74 72 65 | 61 6d 29 2c 20 74 68 65 |ry".stre|am), the|
|000008a0| 6e 20 77 65 20 74 72 61 | 6e 73 6c 61 74 65 20 74 |n we tra|nslate t|
|000008b0| 68 65 20 66 6f 72 6d 61 | 74 20 73 74 72 69 6e 67 |he forma|t string|
|000008c0| 20 62 65 66 6f 72 65 20 | 63 61 6c 6c 69 6e 67 20 | before |calling |
|000008d0| 76 66 70 72 69 6e 74 66 | 28 29 2c 20 61 6e 64 0d |vfprintf|(), and.|
|000008e0| 74 72 61 6e 73 6c 61 74 | 65 20 61 67 61 69 6e 20 |translat|e again |
|000008f0| 61 66 74 65 72 77 61 72 | 64 73 2c 20 72 65 73 74 |afterwar|ds, rest|
|00000900| 6f 72 69 6e 67 20 74 68 | 65 20 6f 72 69 67 69 6e |oring th|e origin|
|00000910| 61 6c 20 73 74 72 69 6e | 67 2e 20 54 68 69 73 20 |al strin|g. This |
|00000920| 69 73 20 61 20 70 72 65 | 74 74 79 20 67 6f 6f 64 |is a pre|tty good|
|00000930| 0d 73 6f 6c 75 74 69 6f | 6e 2c 20 74 72 61 6e 73 |.solutio|n, trans|
|00000940| 6c 61 74 69 6e 67 20 6d | 6f 73 74 20 6f 66 20 74 |lating m|ost of t|
|00000950| 68 65 20 6c 69 6e 65 66 | 65 65 64 73 2c 20 62 75 |he linef|eeds, bu|
|00000960| 74 20 69 74 20 66 61 69 | 6c 73 20 74 6f 20 74 72 |t it fai|ls to tr|
|00000970| 61 6e 73 6c 61 74 65 20 | 6c 69 6e 65 66 65 65 64 |anslate |linefeed|
|00000980| 73 0d 74 68 61 74 20 61 | 70 70 65 61 72 20 69 6e |s.that a|ppear in|
|00000990| 20 73 74 72 69 6e 67 20 | 61 6e 64 20 63 68 61 72 | string |and char|
|000009a0| 20 61 72 67 75 6d 65 6e | 74 73 2e 0d 0d 4f 75 72 | argumen|ts...Our|
|000009b0| 20 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 20 | impleme|ntation |
|000009c0| 6f 66 20 74 72 61 6e 73 | 6c 61 74 69 6f 6e 20 69 |of trans|lation i|
|000009d0| 73 20 69 6e 63 6f 6d 70 | 6c 65 74 65 20 66 6f 72 |s incomp|lete for|
|000009e0| 20 70 72 69 6e 74 66 20 | 65 74 20 61 6c 2e 2c 20 | printf |et al., |
|000009f0| 61 6e 64 0d 6e 6f 6e 65 | 78 69 73 74 65 6e 74 20 |and.none|xistent |
|00000a00| 66 6f 72 20 73 63 61 6e | 66 20 61 6e 64 20 66 73 |for scan|f and fs|
|00000a10| 63 61 6e 66 20 62 65 63 | 61 75 73 65 20 73 63 61 |canf bec|ause sca|
|00000a20| 6e 6e 69 6e 67 20 74 68 | 65 20 76 61 72 69 61 62 |nning th|e variab|
|00000a30| 6c 65 20 61 72 67 75 6d | 65 6e 74 20 6c 69 73 74 |le argum|ent list|
|00000a40| 0d 77 6f 75 6c 64 20 72 | 65 71 75 69 72 65 20 74 |.would r|equire t|
|00000a50| 6f 6f 20 6d 75 63 68 20 | 65 66 66 6f 72 74 2c 20 |oo much |effort, |
|00000a60| 72 65 71 75 69 72 69 6e | 67 20 75 73 20 74 6f 20 |requirin|g us to |
|00000a70| 69 6d 70 6c 65 6d 65 6e | 74 20 61 20 6c 61 72 67 |implemen|t a larg|
|00000a80| 65 20 66 72 61 63 74 69 | 6f 6e 20 6f 66 20 74 68 |e fracti|on of th|
|00000a90| 65 0d 70 72 69 6e 74 66 | 2f 73 63 61 6e 66 20 63 |e.printf|/scanf c|
|00000aa0| 6f 64 65 3a 20 70 61 72 | 73 69 6e 67 20 74 68 65 |ode: par|sing the|
|00000ab0| 20 66 6f 72 6d 61 74 20 | 73 74 72 69 6e 67 20 69 | format |string i|
|00000ac0| 6e 74 6f 20 74 6f 6b 65 | 6e 73 2c 20 72 65 74 72 |nto toke|ns, retr|
|00000ad0| 69 65 76 69 6e 67 20 65 | 61 63 68 0d 61 72 67 75 |ieving e|ach.argu|
|00000ae0| 6d 65 6e 74 2c 20 61 6e | 64 20 70 61 73 73 69 6e |ment, an|d passin|
|00000af0| 67 20 74 68 65 6d 20 6f | 6e 65 20 61 74 20 61 20 |g them o|ne at a |
|00000b00| 74 69 6d 65 20 74 6f 20 | 66 70 72 69 6e 74 66 2f |time to |fprintf/|
|00000b10| 73 63 61 6e 66 2e 0d 0d | 54 68 65 20 74 69 6d 65 |scanf...|The time|
|00000b20| 20 6f 76 65 72 68 65 61 | 64 20 6f 66 20 74 68 65 | overhea|d of the|
|00000b30| 73 65 20 72 6f 75 74 69 | 6e 65 73 20 69 73 20 6e |se routi|nes is n|
|00000b40| 65 67 6c 69 67 69 62 6c | 65 2e 20 41 6c 6c 20 73 |egligibl|e. All s|
|00000b50| 74 64 69 6f 20 66 75 6e | 63 74 69 6f 6e 73 20 74 |tdio fun|ctions t|
|00000b60| 68 61 74 20 6d 61 79 0d | 62 65 20 69 6d 70 6c 65 |hat may.|be imple|
|00000b70| 6d 65 6e 74 65 64 20 61 | 73 20 69 6e 6c 69 6e 65 |mented a|s inline|
|00000b80| 20 6d 61 63 72 6f 73 20 | 61 72 65 20 72 65 64 65 | macros |are rede|
|00000b90| 66 69 6e 65 64 20 62 79 | 20 54 72 61 6e 73 6c 61 |fined by| Transla|
|00000ba0| 74 65 4c 69 6e 65 66 65 | 65 64 73 2e 68 20 61 73 |teLinefe|eds.h as|
|00000bb0| 20 6e 65 77 20 69 6e 6c | 69 6e 65 0d 6d 61 63 72 | new inl|ine.macr|
|00000bc0| 6f 73 20 74 68 61 74 20 | 63 61 6c 6c 20 74 68 65 |os that |call the|
|00000bd0| 20 6f 72 69 67 69 6e 61 | 6c 20 72 6f 75 74 69 6e | origina|l routin|
|00000be0| 65 73 2e 0d 0d 4e 6f 74 | 65 20 74 68 61 74 20 74 |es...Not|e that t|
|00000bf0| 68 65 20 67 65 74 63 68 | 61 72 20 61 6e 64 20 70 |he getch|ar and p|
|00000c00| 75 74 63 68 61 72 20 6d | 61 63 72 6f 73 20 69 6e |utchar m|acros in|
|00000c10| 20 54 72 61 6e 73 6c 61 | 74 65 4c 69 6e 65 66 65 | Transla|teLinefe|
|00000c20| 65 64 73 2e 68 20 61 73 | 73 75 6d 65 20 74 68 61 |eds.h as|sume tha|
|00000c30| 74 20 73 74 64 69 6e 0d | 61 6e 64 20 73 74 64 6f |t stdin.|and stdo|
|00000c40| 75 74 20 61 72 65 20 22 | 74 65 78 74 22 20 73 74 |ut are "|text" st|
|00000c50| 72 65 61 6d 73 2c 20 74 | 68 6f 75 67 68 20 49 20 |reams, t|hough I |
|00000c60| 68 61 76 65 6e 27 74 20 | 63 68 65 63 6b 65 64 20 |haven't |checked |
|00000c70| 77 68 65 74 68 65 72 20 | 74 68 69 73 20 69 73 0d |whether |this is.|
|00000c80| 67 75 61 72 61 6e 74 65 | 65 64 20 62 79 20 53 74 |guarante|ed by St|
|00000c90| 61 6e 64 61 72 64 20 43 | 2e 0d 0d 46 6f 72 20 64 |andard C|...For d|
|00000ca0| 65 62 75 67 67 69 6e 67 | 2c 20 64 69 73 61 62 6c |ebugging|, disabl|
|00000cb0| 69 6e 67 20 74 68 65 20 | 54 52 41 4e 53 4c 41 54 |ing the |TRANSLAT|
|00000cc0| 45 20 66 6c 61 67 20 72 | 65 73 75 6c 74 73 20 69 |E flag r|esults i|
|00000cd0| 6e 20 74 68 65 20 69 64 | 65 6e 74 69 74 79 20 74 |n the id|entity t|
|00000ce0| 72 61 6e 73 6c 61 74 69 | 6f 6e 2c 20 0d 6d 61 6b |ranslati|on, .mak|
|00000cf0| 69 6e 67 20 61 6c 6c 20 | 74 68 65 20 63 6f 64 65 |ing all |the code|
|00000d00| 20 69 6e 6e 6f 63 75 6f | 75 73 2e 0d 0d 48 49 53 | innocuo|us...HIS|
|00000d10| 54 4f 52 59 3a 0d 37 2f | 33 31 2f 39 33 09 64 67 |TORY:.7/|31/93.dg|
|00000d20| 70 20 77 72 6f 74 65 20 | 69 74 2e 0d 37 2f 33 31 |p wrote |it..7/31|
|00000d30| 2f 39 33 09 64 67 70 20 | 41 64 64 65 64 20 73 75 |/93.dgp |Added su|
|00000d40| 70 70 6f 72 74 20 66 6f | 72 20 4d 50 57 20 73 74 |pport fo|r MPW st|
|00000d50| 64 69 6f 20 6c 69 62 72 | 61 72 79 2e 0d 39 2f 32 |dio libr|ary..9/2|
|00000d60| 30 2f 39 33 09 64 67 70 | 20 52 65 77 72 6f 74 65 |0/93.dgp| Rewrote|
|00000d70| 20 76 66 70 72 69 6e 74 | 66 54 4c 20 74 6f 20 77 | vfprint|fTL to w|
|00000d80| 6f 72 6b 20 77 69 74 68 | 20 74 65 78 74 20 73 74 |ork with| text st|
|00000d90| 72 69 6e 67 73 20 6f 66 | 20 75 6e 6c 69 6d 69 74 |rings of| unlimit|
|00000da0| 65 64 20 6c 65 6e 67 74 | 68 2e 0d 09 09 09 44 6f |ed lengt|h.....Do|
|00000db0| 63 75 6d 65 6e 74 65 64 | 20 6c 69 6d 69 74 61 74 |cumented| limitat|
|00000dc0| 69 6f 6e 20 6f 66 20 74 | 68 65 20 6e 65 77 20 76 |ion of t|he new v|
|00000dd0| 66 70 72 69 6e 74 66 54 | 4c 2e 20 49 6d 70 6c 65 |fprintfT|L. Imple|
|00000de0| 6d 65 6e 74 65 64 0d 09 | 09 09 67 65 74 63 2c 20 |mented..|..getc, |
|00000df0| 70 75 74 63 2c 20 67 65 | 74 63 68 61 72 2c 20 61 |putc, ge|tchar, a|
|00000e00| 6e 64 20 70 75 74 63 68 | 61 72 20 61 73 20 69 6e |nd putch|ar as in|
|00000e10| 6c 69 6e 65 20 6d 61 63 | 72 6f 73 2c 20 69 6e 20 |line mac|ros, in |
|00000e20| 54 72 61 6e 73 6c 61 74 | 65 4c 69 6e 65 66 65 65 |Translat|eLinefee|
|00000e30| 64 73 2e 68 2e 0d 2a 2f | 0d 23 69 66 20 21 64 65 |ds.h..*/|.#if !de|
|00000e40| 66 69 6e 65 64 28 54 48 | 49 4e 4b 5f 43 29 0d 09 |fined(TH|INK_C)..|
|00000e50| 23 65 72 72 6f 72 20 22 | 54 68 69 73 20 66 69 6c |#error "|This fil|
|00000e60| 65 20 69 73 20 69 6e 74 | 65 6e 64 65 64 20 73 6f |e is int|ended so|
|00000e70| 6c 65 6c 79 20 66 6f 72 | 20 54 48 49 4e 4b 20 43 |lely for| THINK C|
|00000e80| 20 72 65 73 6f 75 72 63 | 65 73 20 74 68 61 74 20 | resourc|es that |
|00000e90| 77 69 6c 6c 20 62 65 20 | 63 61 6c 6c 65 64 20 62 |will be |called b|
|00000ea0| 79 20 4d 50 57 22 0d 23 | 65 6c 73 65 0d 23 69 6e |y MPW".#|else.#in|
|00000eb0| 63 6c 75 64 65 20 22 54 | 72 61 6e 73 6c 61 74 65 |clude "T|ranslate|
|00000ec0| 4c 69 6e 65 66 65 65 64 | 73 2e 68 22 0d 23 69 6e |Linefeed|s.h".#in|
|00000ed0| 63 6c 75 64 65 20 3c 73 | 74 72 69 6e 67 2e 68 3e |clude <s|tring.h>|
|00000ee0| 0d 23 75 6e 64 65 66 20 | 66 72 65 61 64 0d 23 75 |.#undef |fread.#u|
|00000ef0| 6e 64 65 66 20 66 77 72 | 69 74 65 0d 23 75 6e 64 |ndef fwr|ite.#und|
|00000f00| 65 66 20 66 67 65 74 63 | 0d 23 75 6e 64 65 66 20 |ef fgetc|.#undef |
|00000f10| 75 6e 67 65 74 63 0d 23 | 75 6e 64 65 66 20 66 70 |ungetc.#|undef fp|
|00000f20| 75 74 63 0d 23 75 6e 64 | 65 66 20 67 65 74 73 0d |utc.#und|ef gets.|
|00000f30| 23 75 6e 64 65 66 20 66 | 67 65 74 73 0d 23 75 6e |#undef f|gets.#un|
|00000f40| 64 65 66 20 66 70 75 74 | 73 0d 23 75 6e 64 65 66 |def fput|s.#undef|
|00000f50| 20 76 66 70 72 69 6e 74 | 66 0d 23 64 65 66 69 6e | vfprint|f.#defin|
|00000f60| 65 20 54 52 41 4e 53 4c | 41 54 45 20 31 09 2f 2a |e TRANSL|ATE 1./*|
|00000f70| 20 73 65 74 20 74 68 69 | 73 20 74 6f 20 7a 65 72 | set thi|s to zer|
|00000f80| 6f 20 66 6f 72 20 69 64 | 65 6e 74 69 74 79 20 74 |o for id|entity t|
|00000f90| 72 61 6e 73 6c 61 74 69 | 6f 6e 2c 20 66 6f 72 20 |ranslati|on, for |
|00000fa0| 64 65 62 75 67 67 69 6e | 67 20 2a 2f 0d 0d 75 6e |debuggin|g */..un|
|00000fb0| 73 69 67 6e 65 64 20 63 | 68 61 72 20 74 72 61 6e |signed c|har tran|
|00000fc0| 73 6c 61 74 65 4c 69 6e | 65 66 65 65 64 5b 32 35 |slateLin|efeed[25|
|00000fd0| 36 5d 3d 7b 0d 09 23 69 | 66 20 54 52 41 4e 53 4c |6]={..#i|f TRANSL|
|00000fe0| 41 54 45 0d 09 09 30 2c | 31 2c 32 2c 33 2c 34 2c |ATE...0,|1,2,3,4,|
|00000ff0| 35 2c 36 2c 37 2c 38 2c | 39 2c 31 33 2c 31 31 2c |5,6,7,8,|9,13,11,|
|00001000| 31 32 2c 31 30 2c 31 34 | 2c 31 35 2c 31 36 2c 31 |12,10,14|,15,16,1|
|00001010| 37 2c 31 38 2c 31 39 0d | 09 23 65 6c 73 65 0d 09 |7,18,19.|.#else..|
|00001020| 09 30 2c 31 2c 32 2c 33 | 2c 34 2c 35 2c 36 2c 37 |.0,1,2,3|,4,5,6,7|
|00001030| 2c 38 2c 39 2c 31 30 2c | 31 31 2c 31 32 2c 31 33 |,8,9,10,|11,12,13|
|00001040| 2c 31 34 2c 31 35 2c 31 | 36 2c 31 37 2c 31 38 2c |,14,15,1|6,17,18,|
|00001050| 31 39 0d 09 23 65 6e 64 | 69 66 0d 09 2c 32 30 2c |19..#end|if..,20,|
|00001060| 32 31 2c 32 32 2c 32 33 | 2c 32 34 2c 32 35 2c 32 |21,22,23|,24,25,2|
|00001070| 36 2c 32 37 2c 32 38 2c | 32 39 2c 33 30 2c 33 31 |6,27,28,|29,30,31|
|00001080| 2c 33 32 2c 33 33 2c 33 | 34 2c 33 35 2c 33 36 2c |,32,33,3|4,35,36,|
|00001090| 33 37 2c 33 38 2c 33 39 | 0d 09 2c 34 30 2c 34 31 |37,38,39|..,40,41|
|000010a0| 2c 34 32 2c 34 33 2c 34 | 34 2c 34 35 2c 34 36 2c |,42,43,4|4,45,46,|
|000010b0| 34 37 2c 34 38 2c 34 39 | 2c 35 30 2c 35 31 2c 35 |47,48,49|,50,51,5|
|000010c0| 32 2c 35 33 2c 35 34 2c | 35 35 2c 35 36 2c 35 37 |2,53,54,|55,56,57|
|000010d0| 2c 35 38 2c 35 39 0d 09 | 2c 36 30 2c 36 31 2c 36 |,58,59..|,60,61,6|
|000010e0| 32 2c 36 33 2c 36 34 2c | 36 35 2c 36 36 2c 36 37 |2,63,64,|65,66,67|
|000010f0| 2c 36 38 2c 36 39 2c 37 | 30 2c 37 31 2c 37 32 2c |,68,69,7|0,71,72,|
|00001100| 37 33 2c 37 34 2c 37 35 | 2c 37 36 2c 37 37 2c 37 |73,74,75|,76,77,7|
|00001110| 38 2c 37 39 0d 09 2c 38 | 30 2c 38 31 2c 38 32 2c |8,79..,8|0,81,82,|
|00001120| 38 33 2c 38 34 2c 38 35 | 2c 38 36 2c 38 37 2c 38 |83,84,85|,86,87,8|
|00001130| 38 2c 38 39 2c 39 30 2c | 39 31 2c 39 32 2c 39 33 |8,89,90,|91,92,93|
|00001140| 2c 39 34 2c 39 35 2c 39 | 36 2c 39 37 2c 39 38 2c |,94,95,9|6,97,98,|
|00001150| 39 39 0d 09 2c 31 30 30 | 2c 31 30 31 2c 31 30 32 |99..,100|,101,102|
|00001160| 2c 31 30 33 2c 31 30 34 | 2c 31 30 35 2c 31 30 36 |,103,104|,105,106|
|00001170| 2c 31 30 37 2c 31 30 38 | 2c 31 30 39 2c 31 31 30 |,107,108|,109,110|
|00001180| 2c 31 31 31 2c 31 31 32 | 2c 31 31 33 2c 31 31 34 |,111,112|,113,114|
|00001190| 2c 31 31 35 2c 31 31 36 | 2c 31 31 37 2c 31 31 38 |,115,116|,117,118|
|000011a0| 2c 31 31 39 0d 09 2c 31 | 32 30 2c 31 32 31 2c 31 |,119..,1|20,121,1|
|000011b0| 32 32 2c 31 32 33 2c 31 | 32 34 2c 31 32 35 2c 31 |22,123,1|24,125,1|
|000011c0| 32 36 2c 31 32 37 2c 31 | 32 38 2c 31 32 39 2c 31 |26,127,1|28,129,1|
|000011d0| 33 30 2c 31 33 31 2c 31 | 33 32 2c 31 33 33 2c 31 |30,131,1|32,133,1|
|000011e0| 33 34 2c 31 33 35 2c 31 | 33 36 2c 31 33 37 2c 31 |34,135,1|36,137,1|
|000011f0| 33 38 2c 31 33 39 0d 09 | 2c 31 34 30 2c 31 34 31 |38,139..|,140,141|
|00001200| 2c 31 34 32 2c 31 34 33 | 2c 31 34 34 2c 31 34 35 |,142,143|,144,145|
|00001210| 2c 31 34 36 2c 31 34 37 | 2c 31 34 38 2c 31 34 39 |,146,147|,148,149|
|00001220| 2c 31 35 30 2c 31 35 31 | 2c 31 35 32 2c 31 35 33 |,150,151|,152,153|
|00001230| 2c 31 35 34 2c 31 35 35 | 2c 31 35 36 2c 31 35 37 |,154,155|,156,157|
|00001240| 2c 31 35 38 2c 31 35 39 | 0d 09 2c 31 36 30 2c 31 |,158,159|..,160,1|
|00001250| 36 31 2c 31 36 32 2c 31 | 36 33 2c 31 36 34 2c 31 |61,162,1|63,164,1|
|00001260| 36 35 2c 31 36 36 2c 31 | 36 37 2c 31 36 38 2c 31 |65,166,1|67,168,1|
|00001270| 36 39 2c 31 37 30 2c 31 | 37 31 2c 31 37 32 2c 31 |69,170,1|71,172,1|
|00001280| 37 33 2c 31 37 34 2c 31 | 37 35 2c 31 37 36 2c 31 |73,174,1|75,176,1|
|00001290| 37 37 2c 31 37 38 2c 31 | 37 39 0d 09 2c 31 38 30 |77,178,1|79..,180|
|000012a0| 2c 31 38 31 2c 31 38 32 | 2c 31 38 33 2c 31 38 34 |,181,182|,183,184|
|000012b0| 2c 31 38 35 2c 31 38 36 | 2c 31 38 37 2c 31 38 38 |,185,186|,187,188|
|000012c0| 2c 31 38 39 2c 31 39 30 | 2c 31 39 31 2c 31 39 32 |,189,190|,191,192|
|000012d0| 2c 31 39 33 2c 31 39 34 | 2c 31 39 35 2c 31 39 36 |,193,194|,195,196|
|000012e0| 2c 31 39 37 2c 31 39 38 | 2c 31 39 39 0d 09 2c 32 |,197,198|,199..,2|
|000012f0| 30 30 2c 32 30 31 2c 32 | 30 32 2c 32 30 33 2c 32 |00,201,2|02,203,2|
|00001300| 30 34 2c 32 30 35 2c 32 | 30 36 2c 32 30 37 2c 32 |04,205,2|06,207,2|
|00001310| 30 38 2c 32 30 39 2c 32 | 31 30 2c 32 31 31 2c 32 |08,209,2|10,211,2|
|00001320| 31 32 2c 32 31 33 2c 32 | 31 34 2c 32 31 35 2c 32 |12,213,2|14,215,2|
|00001330| 31 36 2c 32 31 37 2c 32 | 31 38 2c 32 31 39 0d 09 |16,217,2|18,219..|
|00001340| 2c 32 32 30 2c 32 32 31 | 2c 32 32 32 2c 32 32 33 |,220,221|,222,223|
|00001350| 2c 32 32 34 2c 32 32 35 | 2c 32 32 36 2c 32 32 37 |,224,225|,226,227|
|00001360| 2c 32 32 38 2c 32 32 39 | 2c 32 33 30 2c 32 33 31 |,228,229|,230,231|
|00001370| 2c 32 33 32 2c 32 33 33 | 2c 32 33 34 2c 32 33 35 |,232,233|,234,235|
|00001380| 2c 32 33 36 2c 32 33 37 | 2c 32 33 38 2c 32 33 39 |,236,237|,238,239|
|00001390| 0d 09 2c 32 34 30 2c 32 | 34 31 2c 32 34 32 2c 32 |..,240,2|41,242,2|
|000013a0| 34 33 2c 32 34 34 2c 32 | 34 35 2c 32 34 36 2c 32 |43,244,2|45,246,2|
|000013b0| 34 37 2c 32 34 38 2c 32 | 34 39 2c 32 35 30 2c 32 |47,248,2|49,250,2|
|000013c0| 35 31 2c 32 35 32 2c 32 | 35 33 2c 32 35 34 2c 32 |51,252,2|53,254,2|
|000013d0| 35 35 0d 7d 3b 0d 0d 76 | 6f 69 64 20 54 72 61 6e |55.};..v|oid Tran|
|000013e0| 73 6c 61 74 65 4c 69 6e | 65 66 65 65 64 73 28 72 |slateLin|efeeds(r|
|000013f0| 65 67 69 73 74 65 72 20 | 63 68 61 72 20 2a 73 2c |egister |char *s,|
|00001400| 72 65 67 69 73 74 65 72 | 20 73 69 7a 65 5f 74 20 |register| size_t |
|00001410| 6e 29 0d 7b 0d 09 69 66 | 28 73 21 3d 4e 55 4c 4c |n).{..if|(s!=NULL|
|00001420| 29 66 6f 72 28 3b 6e 3e | 30 3b 6e 2d 2d 29 2a 73 |)for(;n>|0;n--)*s|
|00001430| 2b 2b 3d 74 72 61 6e 73 | 6c 61 74 65 4c 69 6e 65 |++=trans|lateLine|
|00001440| 66 65 65 64 5b 28 75 6e | 73 69 67 6e 65 64 20 63 |feed[(un|signed c|
|00001450| 68 61 72 29 2a 73 5d 3b | 0d 7d 0d 0d 73 69 7a 65 |har)*s];|.}..size|
|00001460| 5f 74 20 66 72 65 61 64 | 54 4c 28 76 6f 69 64 20 |_t fread|TL(void |
|00001470| 2a 73 2c 73 69 7a 65 5f | 74 20 73 69 7a 65 2c 73 |*s,size_|t size,s|
|00001480| 69 7a 65 5f 74 20 6e 75 | 6d 69 74 65 6d 73 2c 46 |ize_t nu|mitems,F|
|00001490| 49 4c 45 20 2a 73 74 72 | 65 61 6d 29 0d 7b 0d 09 |ILE *str|eam).{..|
|000014a0| 6e 75 6d 69 74 65 6d 73 | 3d 66 72 65 61 64 28 73 |numitems|=fread(s|
|000014b0| 2c 73 69 7a 65 2c 6e 75 | 6d 69 74 65 6d 73 2c 73 |,size,nu|mitems,s|
|000014c0| 74 72 65 61 6d 29 3b 0d | 09 69 66 28 49 53 5f 54 |tream);.|.if(IS_T|
|000014d0| 45 58 54 28 73 74 72 65 | 61 6d 29 29 54 72 61 6e |EXT(stre|am))Tran|
|000014e0| 73 6c 61 74 65 4c 69 6e | 65 66 65 65 64 73 28 73 |slateLin|efeeds(s|
|000014f0| 2c 73 69 7a 65 2a 6e 75 | 6d 69 74 65 6d 73 29 3b |,size*nu|mitems);|
|00001500| 0d 09 72 65 74 75 72 6e | 20 6e 75 6d 69 74 65 6d |..return| numitem|
|00001510| 73 3b 0d 7d 0d 73 69 7a | 65 5f 74 20 66 77 72 69 |s;.}.siz|e_t fwri|
|00001520| 74 65 54 4c 28 76 6f 69 | 64 20 2a 73 2c 73 69 7a |teTL(voi|d *s,siz|
|00001530| 65 5f 74 20 73 69 7a 65 | 2c 73 69 7a 65 5f 74 20 |e_t size|,size_t |
|00001540| 6e 75 6d 69 74 65 6d 73 | 2c 46 49 4c 45 20 2a 73 |numitems|,FILE *s|
|00001550| 74 72 65 61 6d 29 0d 7b | 0d 09 73 69 7a 65 5f 74 |tream).{|..size_t|
|00001560| 20 6e 3b 0d 09 0d 09 69 | 66 28 49 53 5f 54 45 58 | n;....i|f(IS_TEX|
|00001570| 54 28 73 74 72 65 61 6d | 29 29 54 72 61 6e 73 6c |T(stream|))Transl|
|00001580| 61 74 65 4c 69 6e 65 66 | 65 65 64 73 28 73 2c 73 |ateLinef|eeds(s,s|
|00001590| 69 7a 65 2a 6e 75 6d 69 | 74 65 6d 73 29 3b 0d 09 |ize*numi|tems);..|
|000015a0| 6e 3d 66 77 72 69 74 65 | 28 73 2c 73 69 7a 65 2c |n=fwrite|(s,size,|
|000015b0| 6e 75 6d 69 74 65 6d 73 | 2c 73 74 72 65 61 6d 29 |numitems|,stream)|
|000015c0| 3b 0d 09 69 66 28 49 53 | 5f 54 45 58 54 28 73 74 |;..if(IS|_TEXT(st|
|000015d0| 72 65 61 6d 29 29 54 72 | 61 6e 73 6c 61 74 65 4c |ream))Tr|anslateL|
|000015e0| 69 6e 65 66 65 65 64 73 | 28 73 2c 73 69 7a 65 2a |inefeeds|(s,size*|
|000015f0| 6e 75 6d 69 74 65 6d 73 | 29 3b 0d 09 72 65 74 75 |numitems|);..retu|
|00001600| 72 6e 20 6e 3b 0d 7d 0d | 69 6e 74 20 66 67 65 74 |rn n;.}.|int fget|
|00001610| 63 54 4c 28 46 49 4c 45 | 20 2a 73 74 72 65 61 6d |cTL(FILE| *stream|
|00001620| 29 0d 7b 0d 09 63 68 61 | 72 20 63 3b 0d 0d 09 63 |).{..cha|r c;...c|
|00001630| 3d 66 67 65 74 63 28 73 | 74 72 65 61 6d 29 3b 0d |=fgetc(s|tream);.|
|00001640| 09 69 66 28 49 53 5f 54 | 45 58 54 28 73 74 72 65 |.if(IS_T|EXT(stre|
|00001650| 61 6d 29 29 72 65 74 75 | 72 6e 20 74 72 61 6e 73 |am))retu|rn trans|
|00001660| 6c 61 74 65 4c 69 6e 65 | 66 65 65 64 5b 28 75 6e |lateLine|feed[(un|
|00001670| 73 69 67 6e 65 64 20 63 | 68 61 72 29 63 5d 3b 0d |signed c|har)c];.|
|00001680| 09 65 6c 73 65 20 72 65 | 74 75 72 6e 20 63 3b 0d |.else re|turn c;.|
|00001690| 7d 0d 63 68 61 72 20 2a | 66 67 65 74 73 54 4c 28 |}.char *|fgetsTL(|
|000016a0| 63 68 61 72 20 2a 73 74 | 72 69 6e 67 2c 69 6e 74 |char *st|ring,int|
|000016b0| 20 6e 2c 46 49 4c 45 20 | 2a 73 74 72 65 61 6d 29 | n,FILE |*stream)|
|000016c0| 0d 7b 0d 09 63 68 61 72 | 20 2a 73 3b 0d 09 0d 09 |.{..char| *s;....|
|000016d0| 73 3d 66 67 65 74 73 28 | 73 74 72 69 6e 67 2c 6e |s=fgets(|string,n|
|000016e0| 2c 73 74 72 65 61 6d 29 | 3b 0d 09 69 66 28 49 53 |,stream)|;..if(IS|
|000016f0| 5f 54 45 58 54 28 73 74 | 72 65 61 6d 29 29 54 72 |_TEXT(st|ream))Tr|
|00001700| 61 6e 73 6c 61 74 65 4c | 69 6e 65 66 65 65 64 73 |anslateL|inefeeds|
|00001710| 28 73 2c 73 74 72 6c 65 | 6e 28 73 29 29 3b 0d 09 |(s,strle|n(s));..|
|00001720| 72 65 74 75 72 6e 20 73 | 3b 0d 7d 0d 69 6e 74 20 |return s|;.}.int |
|00001730| 66 70 75 74 63 54 4c 28 | 69 6e 74 20 63 2c 46 49 |fputcTL(|int c,FI|
|00001740| 4c 45 20 2a 73 74 72 65 | 61 6d 29 0d 7b 0d 09 69 |LE *stre|am).{..i|
|00001750| 6e 74 20 69 3b 0d 0d 09 | 69 66 28 49 53 5f 54 45 |nt i;...|if(IS_TE|
|00001760| 58 54 28 73 74 72 65 61 | 6d 29 29 63 3d 74 72 61 |XT(strea|m))c=tra|
|00001770| 6e 73 6c 61 74 65 4c 69 | 6e 65 66 65 65 64 5b 28 |nslateLi|nefeed[(|
|00001780| 75 6e 73 69 67 6e 65 64 | 20 63 68 61 72 29 63 5d |unsigned| char)c]|
|00001790| 3b 0d 09 72 65 74 75 72 | 6e 20 66 70 75 74 63 28 |;..retur|n fputc(|
|000017a0| 63 2c 73 74 72 65 61 6d | 29 3b 0d 7d 0d 69 6e 74 |c,stream|);.}.int|
|000017b0| 20 66 70 75 74 73 54 4c | 28 63 68 61 72 20 2a 73 | fputsTL|(char *s|
|000017c0| 2c 46 49 4c 45 20 2a 73 | 74 72 65 61 6d 29 0d 7b |,FILE *s|tream).{|
|000017d0| 0d 09 69 6e 74 20 65 72 | 72 6f 72 3b 0d 09 0d 09 |..int er|ror;....|
|000017e0| 69 66 28 49 53 5f 54 45 | 58 54 28 73 74 72 65 61 |if(IS_TE|XT(strea|
|000017f0| 6d 29 29 54 72 61 6e 73 | 6c 61 74 65 4c 69 6e 65 |m))Trans|lateLine|
|00001800| 66 65 65 64 73 28 73 2c | 73 74 72 6c 65 6e 28 73 |feeds(s,|strlen(s|
|00001810| 29 29 3b 0d 09 65 72 72 | 6f 72 3d 66 70 75 74 73 |));..err|or=fputs|
|00001820| 28 73 2c 73 74 72 65 61 | 6d 29 3b 0d 09 69 66 28 |(s,strea|m);..if(|
|00001830| 49 53 5f 54 45 58 54 28 | 73 74 72 65 61 6d 29 29 |IS_TEXT(|stream))|
|00001840| 54 72 61 6e 73 6c 61 74 | 65 4c 69 6e 65 66 65 65 |Translat|eLinefee|
|00001850| 64 73 28 73 2c 73 74 72 | 6c 65 6e 28 73 29 29 3b |ds(s,str|len(s));|
|00001860| 0d 09 72 65 74 75 72 6e | 20 65 72 72 6f 72 3b 0d |..return| error;.|
|00001870| 7d 0d 69 6e 74 20 66 70 | 72 69 6e 74 66 54 4c 28 |}.int fp|rintfTL(|
|00001880| 46 49 4c 45 20 2a 73 74 | 72 65 61 6d 2c 63 6f 6e |FILE *st|ream,con|
|00001890| 73 74 20 63 68 61 72 20 | 2a 66 6f 72 6d 61 74 2c |st char |*format,|
|000018a0| 2e 2e 2e 29 0d 7b 0d 09 | 76 61 5f 6c 69 73 74 20 |...).{..|va_list |
|000018b0| 61 72 67 73 3b 0d 09 69 | 6e 74 20 6e 3b 0d 09 0d |args;..i|nt n;...|
|000018c0| 09 76 61 5f 73 74 61 72 | 74 28 61 72 67 73 2c 66 |.va_star|t(args,f|
|000018d0| 6f 72 6d 61 74 29 3b 0d | 09 6e 3d 76 66 70 72 69 |ormat);.|.n=vfpri|
|000018e0| 6e 74 66 54 4c 28 73 74 | 72 65 61 6d 2c 66 6f 72 |ntfTL(st|ream,for|
|000018f0| 6d 61 74 2c 61 72 67 73 | 29 3b 0d 09 76 61 5f 65 |mat,args|);..va_e|
|00001900| 6e 64 28 61 72 67 73 29 | 3b 0d 09 72 65 74 75 72 |nd(args)|;..retur|
|00001910| 6e 20 6e 3b 0d 7d 0d 63 | 68 61 72 20 2a 67 65 74 |n n;.}.c|har *get|
|00001920| 73 54 4c 28 63 68 61 72 | 20 2a 73 74 72 69 6e 67 |sTL(char| *string|
|00001930| 29 0d 7b 0d 09 63 68 61 | 72 20 2a 73 3b 0d 09 0d |).{..cha|r *s;...|
|00001940| 09 73 3d 67 65 74 73 28 | 73 74 72 69 6e 67 29 3b |.s=gets(|string);|
|00001950| 0d 09 69 66 28 49 53 5f | 54 45 58 54 28 73 74 64 |..if(IS_|TEXT(std|
|00001960| 69 6e 29 29 54 72 61 6e | 73 6c 61 74 65 4c 69 6e |in))Tran|slateLin|
|00001970| 65 66 65 65 64 73 28 73 | 2c 73 74 72 6c 65 6e 28 |efeeds(s|,strlen(|
|00001980| 73 29 29 3b 0d 09 72 65 | 74 75 72 6e 20 73 3b 0d |s));..re|turn s;.|
|00001990| 7d 0d 69 6e 74 20 70 72 | 69 6e 74 66 54 4c 28 63 |}.int pr|intfTL(c|
|000019a0| 68 61 72 20 2a 66 6f 72 | 6d 61 74 2c 2e 2e 2e 29 |har *for|mat,...)|
|000019b0| 0d 7b 0d 09 76 61 5f 6c | 69 73 74 20 61 72 67 73 |.{..va_l|ist args|
|000019c0| 3b 0d 09 69 6e 74 20 6e | 3b 0d 09 0d 09 76 61 5f |;..int n|;....va_|
|000019d0| 73 74 61 72 74 28 61 72 | 67 73 2c 66 6f 72 6d 61 |start(ar|gs,forma|
|000019e0| 74 29 3b 0d 09 6e 3d 76 | 66 70 72 69 6e 74 66 54 |t);..n=v|fprintfT|
|000019f0| 4c 28 73 74 64 6f 75 74 | 2c 66 6f 72 6d 61 74 2c |L(stdout|,format,|
|00001a00| 61 72 67 73 29 3b 0d 09 | 76 61 5f 65 6e 64 28 61 |args);..|va_end(a|
|00001a10| 72 67 73 29 3b 0d 09 72 | 65 74 75 72 6e 20 6e 3b |rgs);..r|eturn n;|
|00001a20| 0d 7d 0d 2f 2a 0d 49 6e | 20 76 66 70 72 69 6e 74 |.}./*.In| vfprint|
|00001a30| 66 54 4c 20 77 65 20 6f | 6e 6c 79 20 74 72 61 6e |fTL we o|nly tran|
|00001a40| 73 6c 61 74 65 20 74 68 | 65 20 66 6f 72 6d 61 74 |slate th|e format|
|00001a50| 20 73 74 72 69 6e 67 2e | 20 57 65 27 6c 6c 20 6d | string.| We'll m|
|00001a60| 69 73 73 20 6c 69 6e 65 | 66 65 65 64 73 20 74 68 |iss line|feeds th|
|00001a70| 61 74 0d 61 72 65 20 68 | 69 64 69 6e 67 20 69 6e |at.are h|iding in|
|00001a80| 20 63 68 61 72 20 61 6e | 64 20 73 74 72 69 6e 67 | char an|d string|
|00001a90| 20 61 72 67 75 6d 65 6e | 74 73 20 69 6e 20 74 68 | argumen|ts in th|
|00001aa0| 65 20 76 61 72 69 61 62 | 6c 65 20 61 72 67 75 6d |e variab|le argum|
|00001ab0| 65 6e 74 20 6c 69 73 74 | 2e 20 46 69 6e 64 69 6e |ent list|. Findin|
|00001ac0| 67 0d 74 68 6f 73 65 20 | 77 6f 75 6c 64 20 72 65 |g.those |would re|
|00001ad0| 71 75 69 72 65 20 61 20 | 6d 75 63 68 20 6d 6f 72 |quire a |much mor|
|00001ae0| 65 20 65 6c 61 62 6f 72 | 61 74 65 20 70 72 6f 67 |e elabor|ate prog|
|00001af0| 72 61 6d 2c 20 77 68 69 | 63 68 20 77 6f 75 6c 64 |ram, whi|ch would|
|00001b00| 20 70 61 72 73 65 20 74 | 68 65 20 66 6f 72 6d 61 | parse t|he forma|
|00001b10| 74 0d 73 74 72 69 6e 67 | 2e 0d 2a 2f 0d 69 6e 74 |t.string|..*/.int|
|00001b20| 20 76 66 70 72 69 6e 74 | 66 54 4c 28 46 49 4c 45 | vfprint|fTL(FILE|
|00001b30| 20 2a 73 74 72 65 61 6d | 2c 63 6f 6e 73 74 20 63 | *stream|,const c|
|00001b40| 68 61 72 20 2a 66 6f 72 | 6d 61 74 2c 76 61 5f 6c |har *for|mat,va_l|
|00001b50| 69 73 74 20 61 72 67 73 | 29 0d 7b 0d 09 69 6e 74 |ist args|).{..int|
|00001b60| 20 6e 3b 0d 09 0d 09 69 | 66 28 49 53 5f 54 45 58 | n;....i|f(IS_TEX|
|00001b70| 54 28 73 74 72 65 61 6d | 29 29 54 72 61 6e 73 6c |T(stream|))Transl|
|00001b80| 61 74 65 4c 69 6e 65 66 | 65 65 64 73 28 28 63 68 |ateLinef|eeds((ch|
|00001b90| 61 72 20 2a 29 66 6f 72 | 6d 61 74 2c 73 74 72 6c |ar *)for|mat,strl|
|00001ba0| 65 6e 28 28 63 68 61 72 | 20 2a 29 66 6f 72 6d 61 |en((char| *)forma|
|00001bb0| 74 29 29 3b 0d 09 6e 3d | 76 66 70 72 69 6e 74 66 |t));..n=|vfprintf|
|00001bc0| 28 73 74 72 65 61 6d 2c | 66 6f 72 6d 61 74 2c 61 |(stream,|format,a|
|00001bd0| 72 67 73 29 3b 0d 09 69 | 66 28 49 53 5f 54 45 58 |rgs);..i|f(IS_TEX|
|00001be0| 54 28 73 74 72 65 61 6d | 29 29 54 72 61 6e 73 6c |T(stream|))Transl|
|00001bf0| 61 74 65 4c 69 6e 65 66 | 65 65 64 73 28 28 63 68 |ateLinef|eeds((ch|
|00001c00| 61 72 20 2a 29 66 6f 72 | 6d 61 74 2c 73 74 72 6c |ar *)for|mat,strl|
|00001c10| 65 6e 28 28 63 68 61 72 | 20 2a 29 66 6f 72 6d 61 |en((char| *)forma|
|00001c20| 74 29 29 3b 0d 09 72 65 | 74 75 72 6e 20 6e 3b 0d |t));..re|turn n;.|
|00001c30| 7d 0d 69 6e 74 20 76 70 | 72 69 6e 74 66 54 4c 28 |}.int vp|rintfTL(|
|00001c40| 63 68 61 72 20 2a 66 6f | 72 6d 61 74 2c 76 61 5f |char *fo|rmat,va_|
|00001c50| 6c 69 73 74 20 61 72 67 | 73 29 0d 7b 0d 09 72 65 |list arg|s).{..re|
|00001c60| 74 75 72 6e 20 76 66 70 | 72 69 6e 74 66 54 4c 28 |turn vfp|rintfTL(|
|00001c70| 73 74 64 6f 75 74 2c 66 | 6f 72 6d 61 74 2c 61 72 |stdout,f|ormat,ar|
|00001c80| 67 73 29 3b 0d 7d 0d 23 | 65 6e 64 69 66 00 00 00 |gs);.}.#|endif...|
|00001c90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ca0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001cb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001cc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001cd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001ce0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001cf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001d00| 00 00 01 00 00 00 02 2a | 00 00 01 2a 00 00 00 3e |.......*|...*...>|
|00001d10| 42 57 72 69 74 65 28 28 | 50 61 72 6d 42 6c 6b 50 |BWrite((|ParmBlkP|
|00001d20| 74 72 29 20 26 70 62 2c | 46 41 4c 53 45 29 29 0d |tr) &pb,|FALSE)).|
|00001d30| 14 54 72 61 6e 73 6c 61 | 74 65 4c 69 6e 65 66 65 |.Transla|teLinefe|
|00001d40| 65 64 73 2e 63 61 02 00 | 00 00 50 61 72 74 53 49 |eds.ca..|..PartSI|
|00001d50| 00 00 50 61 72 74 53 49 | 54 21 00 00 00 00 00 00 |..PartSI|T!......|
|00001d60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001d70| 00 00 ab bf ee 72 00 00 | 00 00 00 00 02 68 62 79 |.....r..|.....hby|
|00001d80| 74 65 73 77 72 69 74 74 | 65 6e 29 3b 0d 09 69 66 |teswritt|en);..if|
|00001d90| 20 28 50 42 53 65 74 45 | 4f 46 28 28 50 61 72 6d | (PBSetE|OF((Parm|
|00001da0| 42 6c 6b 50 74 72 29 26 | 70 62 2c 20 46 41 4c 53 |BlkPtr)&|pb, FALS|
|00001db0| 45 29 29 0d 09 09 72 65 | 74 75 72 6e 20 2d 31 3b |E))...re|turn -1;|
|00001dc0| 0d 09 50 42 46 6c 75 73 | 68 46 69 6c 65 28 28 50 |..PBFlus|hFile((P|
|00001dd0| 61 72 6d 42 6c 6b 50 74 | 72 29 26 70 62 2c 46 41 |armBlkPt|r)&pb,FA|
|00001de0| 4c 53 45 29 3b 0d 09 0d | 09 72 65 74 75 72 6e 20 |LSE);...|.return |
|00001df0| 62 79 74 65 73 77 72 69 | 74 74 65 6e 3b 0d 7d 0d |byteswri|tten;.}.|
|00001e00| 00 00 00 da 00 0c 00 00 | 12 e8 00 00 12 fa 13 54 |........|.......T|
|00001e10| 72 61 6e 73 6c 61 74 65 | 4c 69 6e 65 66 65 65 64 |ranslate|Linefeed|
|00001e20| 73 00 00 00 13 6f 00 00 | 13 76 07 66 72 65 61 64 |s....o..|.v.fread|
|00001e30| 54 4c 00 00 14 28 00 00 | 14 30 09 66 77 72 69 74 |TL...(..|.0.fwrit|
|00001e40| 65 54 4c 00 00 00 15 18 | 00 00 15 1f 07 66 67 65 |eTL.....|.....fge|
|00001e50| 74 63 54 4c 00 00 15 a4 | 00 00 15 ab 07 66 67 65 |tcTL....|.....fge|
|00001e60| 74 73 54 4c 00 00 16 3c | 00 00 16 43 07 66 70 75 |tsTL...<|...C.fpu|
|00001e70| 74 63 54 4c 00 00 16 bd | 00 00 16 c4 07 66 70 75 |tcTL....|.....fpu|
|00001e80| 74 73 54 4c 00 00 17 82 | 00 00 17 8b 09 66 70 72 |tsTL....|.....fpr|
|00001e90| 69 6e 74 66 54 4c 00 00 | 18 29 00 00 18 2f 07 67 |intfTL..|.).../.g|
|00001ea0| 65 74 73 54 4c 00 00 00 | 18 a2 00 00 18 aa 09 70 |etsTL...|.......p|
|00001eb0| 72 69 6e 74 66 54 4c 00 | 00 00 1a 2d 00 00 1a 37 |rintfTL.|...-...7|
|00001ec0| 0b 76 66 70 72 69 6e 74 | 66 54 4c 00 00 00 1b 42 |.vfprint|fTL....B|
|00001ed0| 00 00 1b 4b 09 76 70 72 | 69 6e 74 66 54 4c 00 00 |...K.vpr|intfTL..|
|00001ee0| 00 48 00 09 4d 6f 6e 61 | 63 6f 00 00 00 00 00 00 |.H..Mona|co......|
|00001ef0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f00| 00 00 00 00 00 03 00 04 | 00 41 00 09 01 8c 02 7c |........|.A.....||
|00001f10| 00 41 00 09 01 8c 02 7c | aa bc a2 00 00 00 1c 0d |.A.....||........|
|00001f20| 00 00 1c 0d 00 00 19 33 | 01 00 00 00 01 00 00 00 |.......3|........|
|00001f30| 02 2a 00 00 01 2a 00 00 | 00 3e 00 8d c5 0c 1d 62 |.*...*..|.>.....b|
|00001f40| 00 00 00 1c 00 3e 00 00 | 4d 50 53 52 00 01 00 0a |.....>..|MPSR....|
|00001f50| 03 ef ff ff 00 00 00 00 | 00 00 00 00 03 ed ff ff |........|........|
|00001f60| 00 00 00 de 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+